import request from '@/utils/request'

// 查询文章列表
export function listAdmin(query) {
  return request({
    url: '/admin/list',
    method: 'get',
    params: query
  })
}

// 查询角色列表
export function getRoleSelectList() {
  return request({
    url: '/admin/role/getRoleSelectList',
    method: 'get',
  })
}

// 管理员状态修改
export function changeStatus(id,status) {
  return request({
    url: '/admin/changeStatus',
    method: 'put',
    params:{
      id:id,
      status:status
    }
  })
}

// 管理员设置角色
export function setAdminRole(id,roleId) {
  return request({
    url: '/admin/role/setAdminRole',
    method: 'post',
    params:{
      id:id,
      roleId:roleId,
    }
  })
}

// 删除管理员
export function delAdmin(id) {
  return request({
    url: '/admin/deleteAdmin',
    method: 'delete',
    params:{
      id:id,
    }
  })
}

export function addAdmin(data) {
  return request({
    url: '/admin/toaddAdmin',
    method: 'post',
    data: data,
  });
}

export function categoryAdmin() {
  return request({
    url: '/admin/categoryAdmin',
    method: 'get',
  });
}
export function setCategoryAdmin(cid,aid) {
  return request({
    url: '/admin/setCategoryAdmin',
    method: 'post',
    params:{
      cid:cid,
      aid:aid
    }
  });
}

